﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GraphMLComplexType;

namespace ComplexNetCentralityLib
{
    public class CentralityImportanceComparer: IComparer<IGraphMLComplexType>
    {
        #region IComparer<IGraphMLComplexType> Members

        public int Compare(IGraphMLComplexType x, IGraphMLComplexType y)
        {
            if (x == null && y == null) return 0;
            if (x == null) return -1;
            if (y == null) return 1;
            double imp_x = Double.Parse(x.Keys["importance"]);
            double imp_y = Double.Parse(y.Keys["importance"]);
            if (imp_x == imp_y) return 0;
            if (imp_x < imp_y) return 1;
            return -1;
        }

        #endregion
    }
}
